import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { Collection } from "@nestjs/cli/lib/schematics";
import { ApiProperty } from "@nestjs/swagger";

@Entity()
export class Order {
    @PrimaryGeneratedColumn({comment: "主键ID"})
    id: number;

    @ApiProperty({description: "订单编码"})
    @Column({name: "order_code", comment: "订单编码", length: 50})
    orderCode: string

    @ApiProperty( {description: "商品编码"})
    @Column({name: "goods_code", comment: "商品编码", length: 50})
    goodsCode: string

    @ApiProperty({description: "单位的数量：如1件、4件、5罐、2箱"})
    @Column({ comment: "单位的数量：如1件、4件、5罐、2箱"})
    count: number

    @ApiProperty({description: "单位名字：罐、打、件、箱"})
    @Column({comment: "单位名字：罐、打、件、箱", length: 5})
    unit: string;

    @ApiProperty({description: "如：商品A，2件的价格"})
    @Column({comment: "如：商品A，2件的价格", type: "float"})
    price: number;

    @ApiProperty({description: "原总价格：没有折扣的订单总价"})
    @Column({comment: "原总价格：没有折扣的订单总价", type: "float"})
    total: number

    @ApiProperty({description: "折扣：0.9、0.95、0.8、0.88、0.7"})
    @Column({comment: "折扣：0.9、0.95、0.8、0.88、0.7"})
    discount: number

    @ApiProperty({description: "最终的订单价格"})
    @Column({name: "order_price", comment: "最终的订单价格", type: "float"})
    orderPrice: number

    @ApiProperty({description: "商家"})
    @Column({comment: "merchants"})
    merchants: string

    @ApiProperty({description: "订单创建时间"})
    @Column({comment: "订单创建时间", type: "datetime"})
    createTime: Date


}